package com.pwx.student.service.bo;

import io.swagger.models.auth.In;
import org.springframework.stereotype.Service;

/**
 * Copyright (C),2021-2022,亚瑟王
 * FileName: ChoseCourseBo
 * Author: saber
 * Date:2022/10/28 16:32
 */
public class ChoseCourseBo {


    public static boolean checkCourse(String oldChose,String nowChose){
        if (oldChose.equals(nowChose)){
            return true;
        }

        String[] old = oldChose.split("-");
        String[] now = nowChose.split("-");

        if (old[0].equals(now[0])){
            Integer oldInt = Integer.parseInt(old[1]);
            Integer nowInt = Integer.parseInt(now[1]);

            if (oldInt>nowInt){

                Integer time = Integer.parseInt(now[2]);

                return checkTime(nowInt+time,oldInt);
            }else {
                Integer time = Integer.parseInt(old[2]);

                return checkTime(oldInt+time,nowInt);
            }

        }else{
            return false;
        }
    }

    private static boolean checkTime(Integer num1, Integer num2){
        if (num1>num2){
            return true;
        }
        return false;
    }

} 
